<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body">
        <div class="layui-form-item">
            <label class="layui-form-label label-required">平台名称</label>
            <div class="layui-input-block">
                <input name="name" value='{$vo.name|default=""}' required placeholder="请输入姓名" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label label-required">是否含税</label>
            <div class="layui-input-block">
                <select name='is_rate' class='layui-select' lay-search lay-filter="is_rate">
                    <!--{foreach [0=>'否',1=>'是'] as $k=>$v}-->
                    <!--{eq name='k' value='$vo.is_rate|default=0'}-->
                    <option selected value='{$k}'>{$v}</option>
                    <!--{else}-->
                    <option value='{$k}'>{$v}</option>
                    <!--{/eq}-->
                    <!--{/foreach}-->
                </select>
            </div>
        </div>
        <div class="layui-form-item" {if !isset($vo.is_rate) || $vo.is_rate == 0} hidden {/if}>
            <label class="layui-form-label">税率</label>
            <div class="layui-input-block">
                <input name="rate" value='{$vo.rate|default=""}'  placeholder="请输入税率" class="layui-input">
            </div>
        </div>
    </div>
    
    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>

    <script>
    window.form.render();
    form.on('select(is_rate)', function (data) {
        console.log(data.value)
        if(data.value == 0){
            $('input[name="rate"]').parent().parent().hide();
        }else{
            $('input[name="rate"]').parent().parent().show();
        }
    });
    </script>

</form>